/*
 * @Author: 黄达全
 * @Date: 2024-07-19 14:05:32
 * @LastEditTime: 2024-07-20 22:24:52
 */
import { defineConfig } from 'vite'
import vue from '@vitejs/plugin-vue'
import { resolve } from 'path'
import htmlEnv from 'vite-plugin-html-env';

// https://vitejs.dev/config/
export default defineConfig({
  plugins: [
    vue(),
    htmlEnv({
      envPrefix: 'VITE_' as any
    } as any)
  ],
  // 配置静态资源路径别名
  resolve: {
    alias: {
      '@': resolve(__dirname, 'src')
    }
  },
  server: {
    port:8888,
    host:"0.0.0.0",
    proxy: {
      '/api': {
        target: "http://localhost:8080",
        // target: import.meta.env.VITE_API_URL,
        changeOrigin: true,
        rewrite: (path) => path.replace(/^\/api/, '')
      }
    }
  }

})
